﻿#region Using

using System.Runtime.Serialization;

#endregion



namespace Common.Base
{
    [DataContract]
    public class Result
    {
        private static Result success;

        private Result(ResultTypeEnum type, string message)
        {
            this.ResultType = type;
            this.Message = message;
        }

        public static Result Success
        {
            get
            {
                return success ?? (success = new Result(ResultTypeEnum.Success, "Success!"));
            }
        }

        [DataMember]
        public ResultTypeEnum ResultType { get; private set; }

        [DataMember]
        public string Message { get; private set; }

        public static Result Failure(string message)
        {
            return new Result(ResultTypeEnum.Failure, message);
        }
    }
}